/*
 * Copyright (C) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { describe, it, expect, beforeAll, TestType, Size, Level } from '@ohos/hypium';
import { stringToUint8Array, checkSoftware } from './utils/param/publicFunc';
import huks from '@ohos.security.huks';
import Data from './utils/data.json';
import { HuksCipherAES, HuksCipherRSA, HuksCipherSM4 } from './utils/param/cipher/publicCipherParam'
import { HuksHmac } from './utils/param/hmac/publicHmacParam'
import {
    HuksSignVerifyECC,
    HuksSignVerifyED25519,
    HuksSignVerifyRSA,
    HuksSignVerifySM2,
    HuksSignVerifyDSA
} from './utils/param/signverify/publicSignverifyParam'
import { HuksKeyAlgX25519, HuksAgreeECDH } from './utils/param/agree/publicAgreeParam'

let IV = '0000000000000000';
let srcData63 = Data.Data63b;
let srcData63Kb = stringToUint8Array(srcData63);
let AAD = "abababababababab";
let NONCE = "hahahahahaha";
let TAG_SIZE = 16;
let importedAes192PlainKey = "The aes192 key to import";
let callerAes256Kek = "The is kek to encrypt aes192 key";

let wrappingKeyAliasAes192 = "test_wrappingKey_ecdh_aes192";
let callerKeyAlias = "test_caller_key_ecdh_aes192";
let callerKekAliasAes256 = "test_caller_kek_ecdh_aes256";
let callerAgreeKeyAliasAes256 = "test_caller_agree_key_ecdh_aes256";
let importedKeyAliasAes192 = "test_import_key_ecdh_aes192";

let huksPubKey;
let callerSelfPublicKey;
let outSharedKey;
let outPlainKeyEncData;
let outKekEncData;
let outKekEncTag;
let outAgreeKeyEncTag;
let useSoftware = true;

let mask = [0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000];

function subUint8ArrayOf(arrayBuf, start, end) {
    let arr = [];
    for (let i = start; i < end && i < arrayBuf.length; ++i) {
        arr.push(arrayBuf[i]);
    }
    return new Uint8Array(arr);
}

function assignLength(length, arrayBuf, startIndex) {
    let index = startIndex;
    for (let i = 0; i < 4; i++) {
        arrayBuf[index++] = (length & mask[i]) >> (i * 8);
    }
    return 4;
}

function assignData(data, arrayBuf, startIndex) {
    let index = startIndex;
    for (let i = 0; i < data.length; i++) {
        arrayBuf[index++] = data[i];
    }
    return data.length;
}

let aes128Key = new Uint8Array([
    0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec, 0xa3, 0x99, 0x06, 0x59, 0xc8, 0x7f, 0xb8, 0x6a
]);

let aes192Key = new Uint8Array([
    0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec, 0xa3, 0x99, 0x06, 0x59, 0xc8, 0x7f, 0xb8, 0x6a,
    0x20, 0x00, 0x00, 0x00, 0xdc, 0xa3, 0xe3, 0xec
]);

let aes256Key = new Uint8Array([
    0x00, 0x00, 0x00, 0x00, 0x9c, 0xf6, 0x7a, 0x8d, 0xce, 0xc2, 0x7f, 0xa7, 0xd9, 0xfd, 0xf1, 0xad,
    0xac, 0xf0, 0xb3, 0x8c, 0xe8, 0x16, 0xa2, 0x65, 0xcc, 0x18, 0x55, 0x60, 0xcd, 0x2f, 0xf5, 0xe5
]);

let aes512Key = new Uint8Array([
    0x71, 0xf8, 0x91, 0x73, 0x10, 0x00, 0x00, 0x00, 0xf4, 0x1e, 0x7b, 0x01, 0x7a, 0x84, 0x36, 0xa4,
    0xa8, 0x1c, 0x0d, 0x3d, 0xde, 0x57, 0x66, 0x73, 0x10, 0x00, 0x00, 0x00, 0xe3, 0xff, 0x29, 0x97,
    0xad, 0xb3, 0x4a, 0x2c, 0x50, 0x08, 0xb5, 0x68, 0xe1, 0x90, 0x5a, 0xdc, 0x10, 0x00, 0x00, 0x00,
    0xed, 0x0e, 0x12, 0x2d, 0x6b, 0x3d, 0xb3, 0x44, 0xdc, 0x9f, 0xc3, 0xb8, 0xb7, 0x25, 0xff, 0x99
]);

let rsa512Key = new Uint8Array([
    0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    0x40, 0x00, 0x00, 0x00, 0xb6, 0xd8, 0x9b, 0x33, 0x78, 0xa2, 0x63, 0x21, 0x84, 0x47, 0xa1, 0x72,
    0x3d, 0x73, 0x10, 0xbd, 0xe9, 0x5d, 0x78, 0x44, 0x3d, 0x80, 0x18, 0x12, 0x60, 0xed, 0x29, 0x3e,
    0xc7, 0x23, 0x0d, 0x3f, 0x02, 0x59, 0x28, 0xe2, 0x8f, 0x83, 0xdf, 0x37, 0x4b, 0x77, 0xce, 0x5f,
    0xb6, 0xcd, 0x61, 0x72, 0xee, 0x01, 0xe2, 0x37, 0x4d, 0xfd, 0x4f, 0x39, 0xcf, 0xbd, 0xff, 0x84,
    0x57, 0x44, 0xa5, 0x03, 0x01, 0x00, 0x01, 0x35, 0x63, 0x89, 0xed, 0xbd, 0x8b, 0xac, 0xe6, 0x5c,
    0x79, 0x8d, 0xea, 0x8d, 0x86, 0xcb, 0x9c, 0xa8, 0x47, 0x62, 0x96, 0x8a, 0x5e, 0x9c, 0xa8, 0xc1,
    0x24, 0x7e, 0xa6, 0x95, 0xfe, 0xe6, 0x1e, 0xc0, 0xf3, 0x29, 0x76, 0xbb, 0x4d, 0xe4, 0xbc, 0x78,
    0x64, 0xe1, 0x79, 0xcd, 0x8a, 0x45, 0xac, 0x5c, 0x88, 0xea, 0xb4, 0x10, 0xd8, 0x90, 0x65, 0x7b,
    0x94, 0xe8, 0x87, 0x30, 0x2a, 0x04, 0x01,
]);

let rsa768Key = new Uint8Array([
    0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    0x60, 0x00, 0x00, 0x00, 0xc7, 0x06, 0x9c, 0x4b, 0x70, 0x57, 0x9a, 0xb9, 0xd0, 0x3a, 0x4b, 0x0b,
    0xb8, 0x4b, 0x81, 0x54, 0xe7, 0xba, 0xfa, 0xda, 0xf5, 0x04, 0xf0, 0x28, 0x42, 0x6a, 0xb5, 0xb9,
    0xf5, 0x1c, 0x5c, 0x2d, 0xc1, 0x11, 0xe6, 0xe6, 0xe6, 0xfc, 0xeb, 0x33, 0xa0, 0x45, 0xa9, 0x3b,
    0xbf, 0x8f, 0x9d, 0x6e, 0xf5, 0x26, 0xe7, 0xa1, 0xf5, 0x8d, 0x48, 0x48, 0x7f, 0x2a, 0xf8, 0x05,
    0x43, 0xd5, 0xea, 0x56, 0xf4, 0xcf, 0x95, 0xf7, 0x7e, 0x34, 0x0f, 0xee, 0x46, 0x34, 0x05, 0x42,
    0x01, 0xce, 0xce, 0xa0, 0xa4, 0x70, 0x61, 0xb1, 0x99, 0x0d, 0xd8, 0x3c, 0xbf, 0xf9, 0xb2, 0x2a,
    0x32, 0x51, 0x3d, 0xc5, 0x01, 0x00, 0x01, 0x5b, 0x7c, 0xf0, 0x6f, 0xc5, 0x2e, 0xa0, 0x13, 0x76,
    0x62, 0xb5, 0x88, 0xa7, 0xa9, 0x1d, 0xc4, 0x97, 0xd9, 0x5d, 0xe3, 0x34, 0xea, 0x96, 0x33, 0x0b,
    0x84, 0xde, 0x10, 0xa3, 0x59, 0xec, 0x0d, 0xa4, 0x48, 0xc4, 0x69, 0xb4, 0x18, 0xe3, 0x4d, 0x92,
    0x09, 0x33, 0xa8, 0x21, 0x80, 0xb5, 0x0f, 0x32, 0xd7, 0x04, 0xf3, 0x4e, 0x77, 0xba, 0x9b, 0xc5,
    0x20, 0x2c, 0x1e, 0xf7, 0xb3, 0x87, 0x08, 0x03, 0x1f, 0x12, 0x63, 0x4a, 0xbe, 0x5f, 0x71, 0x4d,
    0xf5, 0x5d, 0x3e, 0x4a, 0xaf, 0x84, 0x17, 0x50, 0x9a, 0x5e, 0x04, 0x9e, 0x1f, 0x5a, 0xbd, 0x63,
    0xe7, 0x76, 0x0b, 0x00, 0x22, 0x77, 0xa9,
]);

let rsa1024Key = new Uint8Array([
    0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    0x80, 0x00, 0x00, 0x00, 0xc7, 0x5e, 0x46, 0xc3, 0x5b, 0x4f, 0x9f, 0x2f, 0x5a, 0xcf, 0x31, 0x65,
    0xcc, 0x71, 0x6e, 0x47, 0x60, 0x17, 0x1d, 0x86, 0xb9, 0x8f, 0xe5, 0x4b, 0x85, 0x7a, 0x67, 0xfe,
    0xa2, 0x03, 0x05, 0x55, 0x16, 0xab, 0x51, 0x20, 0x65, 0xc6, 0x83, 0x24, 0x82, 0x58, 0xda, 0x7a,
    0xf9, 0x3f, 0x56, 0xa7, 0xcb, 0x02, 0x8c, 0xfc, 0x4c, 0xf0, 0x17, 0xdf, 0x8f, 0x80, 0x6a, 0xf3,
    0x35, 0xc7, 0x52, 0xa8, 0x4c, 0xef, 0xba, 0x99, 0xc5, 0x2f, 0xc2, 0x9f, 0x78, 0x1d, 0xa5, 0x1a,
    0xc0, 0x28, 0x66, 0x42, 0xa9, 0x65, 0x63, 0xe8, 0xc1, 0x9a, 0xe4, 0xb6, 0xa6, 0x89, 0xac, 0x59,
    0xd0, 0xcf, 0x17, 0xc9, 0x93, 0x6e, 0x57, 0xeb, 0xa1, 0xc2, 0xe1, 0x23, 0x9a, 0x74, 0xbd, 0x60,
    0xd1, 0x98, 0x9a, 0x41, 0xa5, 0x9d, 0xff, 0x71, 0x01, 0x94, 0x97, 0x65, 0x7e, 0xd9, 0xab, 0xa8,
    0x64, 0xeb, 0x41, 0xe9, 0x01, 0x00, 0x01, 0xc5, 0x48, 0x0a, 0x37, 0xf8, 0x5c, 0x52, 0xc6, 0x16,
    0x53, 0x1e, 0xab, 0x80, 0x61, 0xe2, 0x61, 0x68, 0xb9, 0x96, 0xf3, 0x21, 0x1e, 0x3e, 0x24, 0xbc,
    0x41, 0x83, 0x34, 0xda, 0x76, 0xa8, 0xc9, 0x29, 0x34, 0x7f, 0x83, 0xd2, 0x92, 0x5c, 0x65, 0x3d,
    0x42, 0xd5, 0x77, 0x88, 0xba, 0xdf, 0x72, 0x0c, 0x96, 0x4a, 0x92, 0xc3, 0x43, 0x76, 0x2c, 0x38,
    0x21, 0x38, 0x33, 0xd0, 0xcc, 0x9b, 0x81, 0xc5, 0x87, 0xd7, 0x69, 0x8f, 0x1a, 0xb0, 0x59, 0xef,
    0xb8, 0x57, 0x0f, 0x7f, 0xcd, 0x72, 0xfb, 0xf0, 0xe0, 0x9a, 0xa9, 0x92, 0x08, 0x58, 0x9a, 0xf1,
    0xca, 0xe3, 0x6e, 0x87, 0x88, 0xfd, 0xb4, 0x99, 0xec, 0x37, 0xf0, 0x0b, 0x48, 0x9b, 0xf1, 0x85,
    0x78, 0x20, 0x69, 0xb5, 0xe6, 0xdd, 0xe6, 0x9c, 0x71, 0x1c, 0x17, 0xc6, 0x3d, 0x18, 0x9b, 0xfa,
    0x08, 0x7d, 0xe0, 0xd9, 0x05, 0x4c, 0x3d,
]);

let rsa2048Key = new Uint8Array([
    0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    0x00, 0x01, 0x00, 0x00, 0xc5, 0x35, 0x62, 0x48, 0xc4, 0x92, 0x87, 0x73, 0x0d, 0x42, 0x96, 0xfc,
    0x7b, 0x11, 0x05, 0x06, 0x0f, 0x8d, 0x66, 0xc1, 0x0e, 0xad, 0x37, 0x44, 0x92, 0x95, 0x2f, 0x6a,
    0x55, 0xba, 0xec, 0x1d, 0x54, 0x62, 0x0a, 0x4b, 0xd3, 0xc7, 0x05, 0xe4, 0x07, 0x40, 0xd9, 0xb7,
    0xc2, 0x12, 0xcb, 0x9a, 0x90, 0xad, 0xe3, 0x24, 0xe8, 0x5e, 0xa6, 0xf8, 0xd0, 0x6e, 0xbc, 0xd1,
    0x69, 0x7f, 0x6b, 0xe4, 0x2b, 0x4e, 0x1a, 0x65, 0xbb, 0x73, 0x88, 0x6b, 0x7c, 0xaf, 0x7e, 0xd0,
    0x47, 0x26, 0xeb, 0xa5, 0xbe, 0xd6, 0xe8, 0xee, 0x9c, 0xa5, 0x66, 0xa5, 0xc9, 0xd3, 0x25, 0x13,
    0xc4, 0x0e, 0x6c, 0xab, 0x50, 0xb6, 0x50, 0xc9, 0xce, 0x8f, 0x0a, 0x0b, 0xc6, 0x28, 0x69, 0xe9,
    0x83, 0x69, 0xde, 0x42, 0x56, 0x79, 0x7f, 0xde, 0x86, 0x24, 0xca, 0xfc, 0xaa, 0xc0, 0xf3, 0xf3,
    0x7f, 0x92, 0x8e, 0x8a, 0x12, 0x52, 0xfe, 0x50, 0xb1, 0x5e, 0x8c, 0x01, 0xce, 0xfc, 0x7e, 0xf2,
    0x4f, 0x5f, 0x03, 0xfe, 0xa7, 0xcd, 0xa1, 0xfc, 0x94, 0x52, 0x00, 0x8b, 0x9b, 0x7f, 0x09, 0xab,
    0xa8, 0xa4, 0xf5, 0xb4, 0xa5, 0xaa, 0xfc, 0x72, 0xeb, 0x17, 0x40, 0xa9, 0xee, 0xbe, 0x8f, 0xc2,
    0xd1, 0x80, 0xc2, 0x0d, 0x44, 0xa9, 0x59, 0x44, 0x59, 0x81, 0x3b, 0x5d, 0x4a, 0xde, 0xfb, 0xae,
    0x24, 0xfc, 0xa3, 0xd9, 0xbc, 0x57, 0x55, 0xc2, 0x26, 0xbc, 0x19, 0xa7, 0x9a, 0xc5, 0x59, 0xa3,
    0xee, 0x5a, 0xef, 0x41, 0x80, 0x7d, 0xf8, 0x5e, 0xc1, 0x1d, 0x32, 0x38, 0x41, 0x5b, 0xb6, 0x92,
    0xb8, 0xb7, 0x03, 0x0d, 0x3e, 0x59, 0x0f, 0x1c, 0xb3, 0xe1, 0x2a, 0x95, 0x1a, 0x3b, 0x50, 0x4f,
    0xc4, 0x1d, 0xcf, 0x73, 0x7c, 0x14, 0xca, 0xe3, 0x0b, 0xa7, 0xc7, 0x1a, 0x41, 0x4a, 0xee, 0xbe,
    0x1f, 0x43, 0xdd, 0xf9, 0x01, 0x00, 0x01, 0x88, 0x4b, 0x82, 0xe7, 0xe3, 0xe3, 0x99, 0x75, 0x6c,
    0x9e, 0xaf, 0x17, 0x44, 0x3e, 0xd9, 0x07, 0xfd, 0x4b, 0xae, 0xce, 0x92, 0xc4, 0x28, 0x44, 0x5e,
    0x42, 0x79, 0x08, 0xb6, 0xc3, 0x7f, 0x58, 0x2d, 0xef, 0xac, 0x4a, 0x07, 0xcd, 0xaf, 0x46, 0x8f,
    0xb4, 0xc4, 0x43, 0xf9, 0xff, 0x5f, 0x74, 0x2d, 0xb5, 0xe0, 0x1c, 0xab, 0xf4, 0x6e, 0xd5, 0xdb,
    0xc8, 0x0c, 0xfb, 0x76, 0x3c, 0x38, 0x66, 0xf3, 0x7f, 0x01, 0x43, 0x7a, 0x30, 0x39, 0x02, 0x80,
    0xa4, 0x11, 0xb3, 0x04, 0xd9, 0xe3, 0x57, 0x23, 0xf4, 0x07, 0xfc, 0x91, 0x8a, 0xc6, 0xcc, 0xa2,
    0x16, 0x29, 0xb3, 0xe5, 0x76, 0x4a, 0xa8, 0x84, 0x19, 0xdc, 0xef, 0xfc, 0xb0, 0x63, 0x33, 0x0b,
    0xfa, 0xf6, 0x68, 0x0b, 0x08, 0xea, 0x31, 0x52, 0xee, 0x99, 0xef, 0x43, 0x2a, 0xbe, 0x97, 0xad,
    0xb3, 0xb9, 0x66, 0x7a, 0xae, 0xe1, 0x8f, 0x57, 0x86, 0xe5, 0xfe, 0x14, 0x3c, 0x81, 0xd0, 0x64,
    0xf8, 0x86, 0x1a, 0x0b, 0x40, 0x58, 0xc9, 0x33, 0x49, 0xb8, 0x99, 0xc6, 0x2e, 0x94, 0x70, 0xee,
    0x09, 0x88, 0xe1, 0x5c, 0x4e, 0x6c, 0x22, 0x72, 0xa7, 0x2a, 0x21, 0xdd, 0xd7, 0x1d, 0xfc, 0x63,
    0x15, 0x0b, 0xde, 0x06, 0x9c, 0xf3, 0x28, 0xf3, 0xac, 0x4a, 0xa8, 0xb5, 0x50, 0xca, 0x9b, 0xcc,
    0x0a, 0x04, 0xfe, 0x3f, 0x98, 0x68, 0x81, 0xac, 0x24, 0x53, 0xea, 0x1f, 0x1c, 0x6e, 0x5e, 0xca,
    0xe8, 0x31, 0x0d, 0x08, 0x12, 0xf3, 0x26, 0xf8, 0x5e, 0xeb, 0x10, 0x27, 0xae, 0xaa, 0xc3, 0xad,
    0x6c, 0xc1, 0x89, 0xdb, 0x7d, 0x5a, 0x12, 0x55, 0xad, 0x11, 0x19, 0xa1, 0xa9, 0x8f, 0x0b, 0x6d,
    0x78, 0x8d, 0x1c, 0xdf, 0xe5, 0x63, 0x82, 0x0b, 0x7d, 0x23, 0x04, 0xb4, 0x75, 0x8c, 0xed, 0x77,
    0xfc, 0x1a, 0x85, 0x29, 0x11, 0xe0, 0x61,
]);

let rsa3072Key = new Uint8Array([
    0x01, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    0x80, 0x01, 0x00, 0x00, 0xda, 0xa5, 0x05, 0x33, 0x0c, 0x08, 0x77, 0x97, 0xf3, 0x9f, 0x11, 0xab,
    0x2c, 0xb3, 0xc0, 0xd7, 0xd2, 0x4e, 0x84, 0x62, 0xd8, 0x40, 0x27, 0x4f, 0xb3, 0x3e, 0xa4, 0x61,
    0x75, 0xa9, 0x20, 0x1f, 0xc4, 0xe2, 0x79, 0xe9, 0xf5, 0xba, 0xcc, 0x49, 0x30, 0x03, 0xf3, 0xd4,
    0x1b, 0x81, 0xa2, 0x2e, 0xa3, 0x3a, 0x1e, 0xb9, 0x5e, 0xdc, 0xcd, 0x1b, 0xad, 0x64, 0xfb, 0xb6,
    0x78, 0x2f, 0xf6, 0x14, 0x8d, 0x5f, 0x23, 0xca, 0xbd, 0x81, 0xa5, 0x66, 0xfa, 0x26, 0xc8, 0xe1,
    0xa4, 0x16, 0x23, 0x78, 0x49, 0x00, 0xc1, 0xe5, 0xa8, 0xa0, 0x2f, 0xf7, 0xac, 0xcc, 0x82, 0x6f,
    0xa1, 0x89, 0xd9, 0x2f, 0x44, 0x9f, 0x3d, 0x42, 0x81, 0xae, 0x0e, 0xcb, 0x83, 0xaf, 0x4c, 0x7a,
    0x82, 0x2c, 0x8e, 0xc6, 0x88, 0x18, 0x09, 0xaf, 0x15, 0xd0, 0xe9, 0xfa, 0xb5, 0xc2, 0x67, 0xac,
    0x49, 0x96, 0x5b, 0x42, 0x99, 0x20, 0x95, 0xb2, 0xf7, 0x26, 0x31, 0x83, 0x8c, 0x22, 0x09, 0xea,
    0x63, 0xe4, 0x12, 0x8a, 0x42, 0x3a, 0x71, 0xc9, 0xa0, 0xb5, 0xb2, 0x45, 0xe6, 0x0d, 0xda, 0x94,
    0xd3, 0x70, 0xcc, 0x7f, 0x31, 0xd4, 0x3f, 0xe6, 0xed, 0xf5, 0x43, 0x73, 0xf6, 0x06, 0x7f, 0x13,
    0x65, 0x43, 0xd4, 0x35, 0xf2, 0xfc, 0x75, 0x3a, 0xfe, 0x8e, 0x14, 0x5e, 0xa1, 0xed, 0xd1, 0xd2,
    0x96, 0x88, 0xbb, 0xe4, 0x23, 0x52, 0x51, 0x02, 0x81, 0xa6, 0xf9, 0xad, 0x81, 0xf4, 0xf0, 0xc0,
    0x40, 0xbf, 0x4b, 0x97, 0x6f, 0x87, 0x8e, 0xc7, 0xbd, 0xf2, 0x73, 0x2f, 0xe5, 0x3c, 0x62, 0xba,
    0x5f, 0xac, 0xb9, 0x83, 0x0c, 0x61, 0x74, 0xed, 0x0b, 0xbe, 0xff, 0x2a, 0xcf, 0x6d, 0xff, 0xc4,
    0x16, 0x3b, 0xb4, 0x2b, 0x57, 0x62, 0x84, 0xa6, 0x6f, 0xfb, 0x32, 0x72, 0xd7, 0x61, 0xc2, 0x1d,
    0x54, 0x3b, 0xa2, 0xd2, 0x47, 0xe0, 0x96, 0x72, 0xad, 0x28, 0x75, 0xfe, 0x47, 0xdf, 0xf6, 0xcb,
    0xaf, 0x56, 0x9d, 0x2b, 0x1d, 0x62, 0x26, 0xd8, 0xe5, 0xa6, 0x2a, 0xc9, 0x0a, 0x85, 0x71, 0x63,
    0x2e, 0x16, 0x17, 0xf4, 0x2f, 0x17, 0x01, 0x8a, 0x3d, 0x2f, 0xd2, 0xb2, 0x80, 0xa1, 0x04, 0x30,
    0x38, 0x0c, 0xeb, 0x06, 0x2e, 0xc4, 0x4f, 0x80, 0xfb, 0x6b, 0xf7, 0x3c, 0x53, 0x41, 0x5e, 0xdc,
    0xc1, 0xfd, 0x1a, 0xda, 0x0c, 0x58, 0xa5, 0xb0, 0x99, 0xb2, 0xcd, 0x8f, 0x52, 0x81, 0xd1, 0x82,
    0xb2, 0x3b, 0x07, 0xaf, 0xd0, 0xd4, 0xd7, 0x92, 0xd3, 0x51, 0x87, 0x13, 0x4c, 0xf7, 0x87, 0xb9,
    0x74, 0x42, 0xde, 0x8c, 0x65, 0xe2, 0x68, 0xce, 0x62, 0x5d, 0x02, 0xed, 0xa6, 0xff, 0xf2, 0x87,
    0x2a, 0x00, 0xae, 0xbe, 0xe0, 0xda, 0xe5, 0xfe, 0xb4, 0xb8, 0x0a, 0xfb, 0xfe, 0x89, 0x43, 0xde,
    0xd2, 0xb6, 0x4e, 0x81, 0x01, 0x00, 0x01, 0xd7, 0xd6, 0xbf, 0xe3, 0x3c, 0xa5, 0xbf, 0x29, 0xc9,
    0xdd, 0xe5, 0xdb, 0x4d, 0x2d, 0xc5, 0xd9, 0x48, 0x4b, 0x2a, 0x75, 0x49, 0x75, 0x4b, 0x59, 0x6a,
    0x61, 0x14, 0x75, 0x01, 0x6a, 0x0b, 0xc4, 0x50, 0xe0, 0x21, 0xe9, 0xcc, 0x22, 0xb3, 0x38, 0x2c,
    0xa6, 0x3a, 0x35, 0xd1, 0x51, 0x8f, 0x80, 0xea, 0xb1, 0x9d, 0x52, 0xf1, 0x4a, 0x97, 0x50, 0x13,
    0x43, 0xf5, 0x18, 0x94, 0x5d, 0x04, 0x58, 0x15, 0x97, 0x2e, 0x06, 0x1e, 0x3d, 0xb5, 0xc2, 0x8a,
    0x7f, 0x6f, 0x1f, 0x10, 0x94, 0xaa, 0x3f, 0x3c, 0x11, 0xfb, 0x57, 0x73, 0xb7, 0x6e, 0xa2, 0xd9,
    0x7a, 0xa9, 0xe8, 0xf9, 0x56, 0xd3, 0x87, 0xcd, 0xfe, 0x44, 0xc3, 0x3a, 0xb1, 0x50, 0xf9, 0xa6,
    0xed, 0x8e, 0x5a, 0x01, 0xd7, 0x6a, 0xba, 0xa1, 0xee, 0xd8, 0xe0, 0x76, 0x70, 0xde, 0x0a, 0x19,
    0x13, 0xe8, 0xb4, 0x33, 0x90, 0xb2, 0x56, 0x74, 0x43, 0xae, 0x84, 0x15, 0x67, 0x26, 0xc9, 0xed,
    0xb4, 0x4c, 0x85, 0x8e, 0x46, 0xbf, 0xe6, 0xac, 0xaa, 0x75, 0x59, 0xcd, 0xc4, 0x90, 0x50, 0x60,
    0x62, 0x9c, 0xbc, 0xfe, 0x5e, 0x04, 0x02, 0x2c, 0x76, 0x92, 0xfe, 0xad, 0x39, 0xc9, 0x74, 0xd8,
    0x12, 0x61, 0xb0, 0x0b, 0xef, 0x81, 0xb6, 0x20, 0x41, 0x08, 0x99, 0x4c, 0x61, 0x85, 0xca, 0x45,
    0xa0, 0x37, 0xd9, 0xe3, 0xb0, 0xe7, 0x88, 0xe3, 0x7c, 0xd0, 0x70, 0xc2, 0x38, 0x22, 0x50, 0xd8,
    0xa8, 0xe8, 0xba, 0x76, 0x6e, 0x4b, 0x9d, 0x2b, 0x5c, 0x84, 0xf7, 0x0b, 0xce, 0xc9, 0x63, 0x5c,
    0x6e, 0x27, 0xa3, 0xac, 0xad, 0x42, 0xfb, 0xa6, 0x6c, 0x48, 0xca, 0x10, 0xa2, 0x30, 0x29, 0xc3,
    0x00, 0x07, 0x2c, 0xd8, 0x3f, 0xd1, 0x39, 0xee, 0x58, 0x9a, 0x8b, 0x54, 0x8b, 0xf0, 0xc4, 0x3a,
    0xeb, 0x84, 0xda, 0x14, 0x63, 0x06, 0xe0, 0x03, 0xcb, 0x83, 0x75, 0x61, 0xa5, 0x54, 0x24, 0xc3,
    0xb6, 0xd8, 0xa8, 0xbc, 0x26, 0x50, 0x74, 0x45, 0x9d, 0x7a, 0xea, 0xe2, 0x37, 0xf0, 0xfb, 0x5a,
    0xd1, 0xff, 0x3b, 0x97, 0x43, 0xad, 0xf5, 0x19, 0xbf, 0x7a, 0x6f, 0xb7, 0x68, 0x50, 0xbb, 0x84,
    0xaa, 0x6e, 0xc8, 0xf4, 0xd2, 0x4e, 0xd0, 0x5d, 0xd2, 0x19, 0x22, 0xaf, 0xf1, 0xd2, 0x39, 0x93,
    0x7d, 0xfa, 0x00, 0x1b, 0x61, 0x02, 0x82, 0xcf, 0x13, 0xf1, 0xdf, 0x09, 0x9d, 0x73, 0xeb, 0x3a,
    0x3a, 0x8b, 0x01, 0x02, 0xff, 0xf3, 0x1a, 0xa3, 0xb3, 0x3a, 0xe8, 0xac, 0xd1, 0x72, 0xe4, 0xac,
    0x31, 0x25, 0x17, 0xe1, 0xdb, 0x7d, 0x9b, 0x04, 0x2d, 0x58, 0xbf, 0x27, 0xa2, 0x49, 0x4e, 0x3d,
    0x84, 0x0b, 0xd6, 0xf0, 0x1d, 0xc9, 0x80, 0xfb, 0xf5, 0x80, 0xa5, 0x06, 0x75, 0x97, 0xf2, 0x09,
    0x41, 0x4c, 0xe4, 0x10, 0x2b, 0xfc, 0x61,
]);

let rsa4096Key = new Uint8Array([
    0x01, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    0x00, 0x02, 0x00, 0x00, 0xcd, 0x1f, 0x40, 0xcd, 0x37, 0x56, 0x2f, 0x78, 0xbb, 0x27, 0x1e, 0xba,
    0x66, 0xba, 0x84, 0xc6, 0xdb, 0xa0, 0x72, 0xf3, 0x1b, 0x53, 0x8c, 0x46, 0x99, 0x65, 0x0d, 0xf7,
    0xb4, 0xae, 0x19, 0x46, 0x1e, 0x05, 0xb0, 0xbc, 0xe1, 0x84, 0x9b, 0x44, 0xc5, 0x06, 0x18, 0xef,
    0x68, 0x4b, 0x80, 0xf4, 0xfc, 0x00, 0x79, 0x8e, 0x21, 0x5e, 0x8f, 0x26, 0x65, 0x69, 0x09, 0x31,
    0x4b, 0xa0, 0x95, 0x37, 0x53, 0xa2, 0xf5, 0x52, 0x78, 0xb5, 0x3c, 0xec, 0x58, 0x25, 0x1f, 0x23,
    0x99, 0x89, 0xc1, 0x46, 0x29, 0x65, 0xbb, 0xbe, 0x59, 0x4c, 0xe4, 0x6f, 0xfc, 0xeb, 0x53, 0xe5,
    0x33, 0x6e, 0x9a, 0x14, 0x57, 0x2a, 0x39, 0xc5, 0xec, 0x4e, 0xc3, 0x3e, 0xcf, 0x76, 0xa3, 0xe9,
    0xf8, 0xe3, 0x8a, 0x40, 0x1b, 0x3d, 0x07, 0x0e, 0xe4, 0x8e, 0xc7, 0x03, 0xbe, 0xf0, 0x3b, 0xb1,
    0x25, 0x4d, 0x20, 0x07, 0x9d, 0x2a, 0x18, 0x92, 0x4b, 0x62, 0x34, 0x73, 0xbc, 0x60, 0x3c, 0x18,
    0xa2, 0xf8, 0x23, 0x3f, 0x43, 0xa5, 0xd8, 0x0c, 0x3f, 0x36, 0xd3, 0x4a, 0x83, 0xe8, 0x93, 0xce,
    0x55, 0x6b, 0x31, 0xeb, 0x8e, 0x8d, 0xc0, 0x01, 0x96, 0xee, 0x4c, 0x15, 0xf1, 0x21, 0x5b, 0x34,
    0xe9, 0x42, 0x1a, 0x4a, 0x7b, 0x6f, 0x58, 0x0b, 0x44, 0x4b, 0xc6, 0x9e, 0x15, 0x1c, 0xb9, 0x49,
    0x97, 0x99, 0xfc, 0x4b, 0xac, 0x9e, 0xc8, 0xfe, 0x97, 0xf7, 0x56, 0x62, 0x7e, 0x8f, 0x0e, 0xd2,
    0x8a, 0xc3, 0x65, 0x72, 0xe8, 0xcd, 0xb0, 0xbb, 0x21, 0x95, 0xb5, 0x4a, 0x6e, 0x57, 0x13, 0xf9,
    0x68, 0x9f, 0xab, 0x53, 0xe8, 0xab, 0x10, 0x36, 0x6f, 0x0f, 0x53, 0x53, 0x0b, 0xcd, 0x9b, 0x16,
    0x7f, 0x33, 0xfa, 0x45, 0x2d, 0x52, 0x4d, 0x67, 0x5d, 0x4e, 0xcd, 0x67, 0xef, 0x32, 0x09, 0x09,
    0xe6, 0x26, 0x37, 0x63, 0x4e, 0x43, 0x4e, 0x70, 0xc1, 0xc8, 0xc7, 0xf1, 0x98, 0x81, 0xa3, 0x94,
    0xa3, 0x3f, 0xe5, 0x40, 0x00, 0x26, 0xf9, 0xef, 0x37, 0x57, 0xdc, 0xf4, 0x14, 0x52, 0x8e, 0x24,
    0xf2, 0x80, 0xf7, 0x09, 0x94, 0x29, 0x04, 0xc0, 0x93, 0xdc, 0xc4, 0xfb, 0x67, 0xa3, 0x93, 0x48,
    0xfe, 0x3e, 0x50, 0x3e, 0x40, 0xbf, 0xa5, 0xfb, 0x73, 0xf7, 0x72, 0xad, 0x1e, 0x79, 0x95, 0x3d,
    0x52, 0x06, 0x6c, 0xc1, 0xfa, 0x63, 0x92, 0xcd, 0xfc, 0xc8, 0x61, 0x9f, 0x8d, 0xc1, 0xc3, 0xce,
    0x5d, 0x88, 0xcd, 0xf0, 0xce, 0x82, 0xb4, 0x2d, 0x17, 0x01, 0x03, 0x74, 0xb1, 0x4c, 0x7c, 0xeb,
    0x53, 0xd6, 0x2a, 0x4c, 0x99, 0xb1, 0x17, 0x89, 0xb6, 0x50, 0x37, 0x51, 0xb4, 0xea, 0x54, 0x4f,
    0x34, 0x5c, 0xc2, 0xa6, 0xe7, 0x15, 0x6c, 0x35, 0xa4, 0x18, 0x76, 0x44, 0x52, 0xda, 0x66, 0x0c,
    0x18, 0x49, 0x2f, 0x7e, 0x54, 0x59, 0xfa, 0x9c, 0xbb, 0xc3, 0xf4, 0x57, 0x59, 0x53, 0x90, 0xca,
    0x73, 0x62, 0xc6, 0xbd, 0xd4, 0x37, 0x0f, 0x6b, 0xb8, 0x6f, 0xbf, 0x24, 0xd4, 0xef, 0xde, 0x98,
    0x9c, 0x05, 0x30, 0xc5, 0xa6, 0xb9, 0x39, 0xe8, 0x5b, 0xc5, 0x30, 0xb8, 0x18, 0xb0, 0x86, 0x33,
    0x1f, 0x36, 0x64, 0xe7, 0x18, 0xd5, 0x05, 0xf5, 0x7d, 0x23, 0xe7, 0xdd, 0x96, 0x1a, 0x82, 0xf4,
    0xfd, 0x90, 0x86, 0x69, 0xb5, 0x4b, 0x7b, 0xec, 0x4d, 0x1a, 0x78, 0xad, 0x6f, 0x55, 0x69, 0xc7,
    0x8d, 0x69, 0x00, 0x8b, 0x56, 0x8e, 0x4c, 0xef, 0x1d, 0xe3, 0xa8, 0xbd, 0xa8, 0x93, 0xfc, 0xc8,
    0xc9, 0x1f, 0x4c, 0x0c, 0x64, 0xc4, 0x42, 0x15, 0xdc, 0xfd, 0x57, 0x44, 0xe6, 0xf8, 0x83, 0xc5,
    0xb5, 0x97, 0x2a, 0xd1, 0x0d, 0x30, 0xb4, 0xef, 0xac, 0x7f, 0xc8, 0xcf, 0x90, 0x83, 0x89, 0xb3,
    0x2c, 0xc7, 0xb0, 0x5b, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc2, 0x48, 0x91, 0x01, 0x8b, 0xcc, 0xf8,
    0x58, 0x58, 0xd8, 0x12, 0x66, 0xd3, 0x98, 0xdb, 0xd6, 0xce, 0x06, 0xa5, 0x06, 0x46, 0x64, 0x85,
    0x35, 0x49, 0x3b, 0x4f, 0x9a, 0xdc, 0x11, 0x23, 0x89, 0x7f, 0x9c, 0xd1, 0xce, 0x15, 0xad, 0x1c,
    0x9d, 0x4a, 0x90, 0x97, 0x71, 0x8f, 0xc0, 0xd5, 0x49, 0x62, 0x93, 0x6e, 0x85, 0xfa, 0x27, 0x07,
    0x61, 0x3f, 0x28, 0x71, 0xbf, 0x7d, 0x80, 0xb3, 0x04, 0xdf, 0xc0, 0x21, 0xaf, 0x52, 0x9f, 0x59,
    0xff, 0x88, 0xe8, 0x89, 0xd9, 0x2c, 0x33, 0x22, 0x80, 0xe8, 0x63, 0xca, 0x8d, 0xaf, 0x7f, 0xa8,
    0xc4, 0x21, 0x6e, 0xc8, 0xe3, 0x7c, 0xeb, 0xb6, 0xde, 0x96, 0x81, 0xcc, 0x91, 0xf7, 0x4e, 0x4a,
    0xe2, 0x0b, 0x38, 0x69, 0x69, 0x70, 0x8d, 0xc3, 0xb2, 0x19, 0xa6, 0x94, 0xc3, 0xfa, 0xb6, 0x7e,
    0xc2, 0xa5, 0x2e, 0x50, 0x4e, 0x4a, 0xf0, 0x15, 0x89, 0x01, 0x1e, 0xc4, 0x47, 0x3c, 0xdf, 0x02,
    0x30, 0xb9, 0x30, 0xd2, 0xfc, 0xb3, 0xda, 0xb6, 0xd8, 0x58, 0xf6, 0x83, 0xb9, 0x2e, 0xb2, 0xb1,
    0x92, 0x44, 0x34, 0xa0, 0xa0, 0xae, 0xde, 0x08, 0xf0, 0xb4, 0x65, 0x09, 0x92, 0x1d, 0x10, 0x10,
    0x96, 0x35, 0xba, 0xd6, 0xdc, 0xb7, 0x55, 0xc6, 0xa5, 0x5d, 0xb8, 0x62, 0x5e, 0x3c, 0x4d, 0xca,
    0x75, 0x4b, 0xb9, 0xff, 0x10, 0x4e, 0x21, 0xd8, 0x50, 0x9c, 0xb6, 0x2f, 0x97, 0x60, 0x65, 0x46,
    0x00, 0xf8, 0x4a, 0x33, 0xe9, 0xf0, 0x75, 0x7f, 0x8f, 0x67, 0x7d, 0xd2, 0x5f, 0x01, 0x6e, 0xbb,
    0x60, 0x43, 0x0a, 0x03, 0xde, 0xaa, 0x69, 0x4a, 0xab, 0x00, 0x0a, 0x48, 0xd3, 0xb2, 0xb8, 0x00,
    0x84, 0xc8, 0x06, 0x89, 0x4a, 0xa2, 0x25, 0xec, 0x3c, 0x12, 0x2c, 0xb1, 0x52, 0x0d, 0xe5, 0x90,
    0xa5, 0x94, 0x78, 0x86, 0x17, 0x51, 0xb6, 0xdc, 0x1a, 0xd4, 0xc2, 0xf3, 0x4e, 0xa9, 0xf8, 0x90,
    0x86, 0xd0, 0x34, 0xa6, 0x80, 0x8a, 0x40, 0x13, 0xd2, 0xa1, 0x68, 0x27, 0xca, 0xfe, 0x66, 0xc5,
    0x2c, 0x7f, 0x79, 0x60, 0x8d, 0x27, 0xac, 0xbb, 0xa8, 0x61, 0xe0, 0xa0, 0x10, 0x64, 0x97, 0xb0,
    0x0f, 0xa7, 0xef, 0xe8, 0x88, 0x09, 0xac, 0x46, 0x80, 0xbe, 0x90, 0xa5, 0xe6, 0xc9, 0xba, 0x4b,
    0x10, 0x91, 0x24, 0xa7, 0x02, 0x00, 0x5c, 0x49, 0x16, 0x1d, 0xa1, 0x1f, 0xbf, 0x71, 0x36, 0x9e,
    0xfd, 0x4b, 0xc7, 0x7e, 0x98, 0xee, 0x7b, 0x97, 0xf3, 0xa5, 0x3f, 0x52, 0xc4, 0x87, 0x20, 0xdc,
    0x14, 0xfa, 0xae, 0x34, 0xd2, 0xf5, 0x7a, 0x26, 0x3a, 0x01, 0xba, 0x15, 0x52, 0xd0, 0x3d, 0xe4,
    0x42, 0x2b, 0x5b, 0x96, 0x54, 0x41, 0xd6, 0x29, 0x3f, 0x06, 0xf0, 0xb2, 0x6a, 0x59, 0x9a, 0x99,
    0xa3, 0xa8, 0x40, 0x67, 0xba, 0x41, 0x42, 0xce, 0x02, 0x1d, 0x48, 0xda, 0x91, 0x85, 0x5c, 0x87,
    0x5a, 0xe7, 0xa4, 0x35, 0x26, 0xaa, 0x4f, 0x04, 0xd4, 0x30, 0x18, 0x8c, 0xb1, 0x2f, 0x89, 0x5f,
    0x3e, 0x49, 0x0c, 0x4d, 0x21, 0xe0, 0xd9, 0x10, 0xb2, 0x5e, 0x66, 0x8f, 0x33, 0x96, 0xaf, 0x61,
    0xff, 0xc6, 0x95, 0xd3, 0xb1, 0x8c, 0x71, 0x1f, 0xc4, 0x95, 0x8f, 0xb8, 0x32, 0x0a, 0x71, 0x3f,
    0xc5, 0xe8, 0xca, 0x88, 0xc7, 0xd3, 0xa1, 0x25, 0xcb, 0xf8, 0x04, 0x04, 0x53, 0x28, 0xf2, 0xf0,
    0xb5, 0xf5, 0x8f, 0xf8, 0xdc, 0x57, 0xb4, 0xc8, 0x13, 0x80, 0x55, 0x33, 0xc1, 0xdd, 0x88, 0xcc,
    0x37, 0xc9, 0xcd, 0xa3, 0x2b, 0x2b, 0x2c, 0xe2, 0xdb, 0xd7, 0xca, 0x34, 0xe0, 0x0c, 0xb5, 0x3c,
    0xa3, 0x12, 0xa6, 0x94, 0x68, 0xaa, 0x66, 0xc7, 0x92, 0xe2, 0xde, 0x06, 0xbb, 0x48, 0xee, 0x27,
    0x03, 0x7c, 0x0e, 0xf5, 0x51, 0xca, 0xd9,
]);

let ecc224Key = new Uint8Array([
    0x02, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
    0x1c, 0x00, 0x00, 0x00, 0x44, 0x84, 0xdd, 0x24, 0xe3, 0x2a, 0xff, 0x99, 0x5e, 0x2a, 0x48, 0x56,
    0xc9, 0x13, 0x16, 0xdf, 0x78, 0x93, 0x1d, 0x3a, 0xbe, 0xba, 0x24, 0xf3, 0xbb, 0x2e, 0xcd, 0x1f,
    0x3f, 0x4a, 0x06, 0x7a, 0xb8, 0xc8, 0x8d, 0x5d, 0x60, 0x19, 0x92, 0x29, 0x06, 0x3c, 0x22, 0xdc,
    0x57, 0x32, 0x45, 0xb9, 0xe4, 0x42, 0x9f, 0xf2, 0xf6, 0xb7, 0xf9, 0xbe, 0x5b, 0x5b, 0x05, 0xea,
    0xec, 0xbf, 0x77, 0xba, 0x29, 0x79, 0x54, 0x5a, 0x4d, 0x10, 0x56, 0x3d, 0x1c, 0x37, 0x12, 0x4c,
    0x34, 0xf7, 0x71, 0xb6, 0x68, 0xf1, 0x26, 0x28,
]);

let ecc256Key = new Uint8Array([
    0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
    0x20, 0x00, 0x00, 0x00, 0xa5, 0xb8, 0xa3, 0x78, 0x1d, 0x6d, 0x76, 0xe0, 0xb3, 0xf5, 0x6f, 0x43,
    0x9d, 0xcf, 0x60, 0xf6, 0x0b, 0x3f, 0x64, 0x45, 0xa8, 0x3f, 0x1a, 0x96, 0xf1, 0xa1, 0xa4, 0x5d,
    0x3e, 0x2c, 0x3f, 0x13, 0xd7, 0x81, 0xf7, 0x2a, 0xb5, 0x8d, 0x19, 0x3d, 0x9b, 0x96, 0xc7, 0x6a,
    0x10, 0xf0, 0xaa, 0xbc, 0x91, 0x6f, 0x4d, 0xa7, 0x09, 0xb3, 0x57, 0x88, 0x19, 0x6f, 0x00, 0x4b,
    0xad, 0xee, 0x34, 0x35, 0xfb, 0x8b, 0x9f, 0x12, 0xa0, 0x83, 0x19, 0xbe, 0x6a, 0x6f, 0x63, 0x2a,
    0x7c, 0x86, 0xba, 0xca, 0x64, 0x0b, 0x88, 0x96, 0xe2, 0xfa, 0x77, 0xbc, 0x71, 0xe3, 0x0f, 0x0f,
    0x9e, 0x3c, 0xe5, 0xf9,
]);

let ecc384Key = new Uint8Array([
    0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
    0x30, 0x00, 0x00, 0x00, 0xcf, 0xd3, 0x04, 0xa8, 0xe8, 0x10, 0xf9, 0x95, 0xe3, 0xf3, 0x6c, 0xbb,
    0x72, 0x1b, 0x7c, 0x82, 0x38, 0x67, 0xc7, 0x0f, 0xd5, 0x2e, 0x6d, 0xdf, 0x49, 0xb0, 0xf0, 0x21,
    0x2c, 0x70, 0xb7, 0xcf, 0x21, 0x9d, 0xf3, 0xcd, 0x2e, 0x3e, 0xf9, 0x46, 0x34, 0x8f, 0xc1, 0x77,
    0xc7, 0x4d, 0x72, 0x3c, 0xb5, 0x87, 0xfd, 0xd1, 0x15, 0xb1, 0x1a, 0x42, 0x9d, 0x72, 0x04, 0xee,
    0x29, 0xb6, 0x8d, 0xc0, 0x18, 0x23, 0xc1, 0x5e, 0x85, 0x61, 0xe9, 0xaf, 0x2c, 0x58, 0x62, 0x77,
    0x5d, 0x44, 0xe5, 0x06, 0x30, 0x67, 0x9c, 0x3d, 0xa8, 0x42, 0xc6, 0x8e, 0x35, 0x5e, 0xc4, 0x67,
    0x04, 0xce, 0x88, 0x2d, 0xd5, 0x12, 0xd7, 0x12, 0x29, 0x17, 0xe8, 0x27, 0x08, 0xe3, 0x30, 0x42,
    0xe5, 0xa4, 0x11, 0xbd, 0xbd, 0x1b, 0x27, 0xb2, 0xc6, 0x74, 0xe4, 0xbd, 0x5e, 0x2c, 0x75, 0xd1,
    0xd8, 0x2b, 0xe7, 0x14, 0x0c, 0xee, 0x36, 0x24, 0x99, 0x7a, 0x12, 0xeb, 0xac, 0x57, 0x78, 0x76,
    0xfb, 0x4b, 0x2e, 0x9e,
]);

let ecc521Key = new Uint8Array([
    0x02, 0x00, 0x00, 0x00, 0x09, 0x02, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00,
    0x42, 0x00, 0x00, 0x00, 0x00, 0x50, 0xfb, 0xd2, 0x63, 0x0f, 0xfb, 0xd3, 0x05, 0x22, 0xd4, 0x05,
    0x8a, 0x79, 0xab, 0x38, 0xac, 0x59, 0xe7, 0x20, 0xfb, 0xf3, 0x2f, 0x07, 0xbf, 0xdf, 0x3e, 0x72,
    0xe6, 0xef, 0x04, 0x46, 0x9e, 0xc0, 0x6e, 0x5e, 0x37, 0x04, 0xe5, 0x88, 0x4d, 0xba, 0x54, 0x73,
    0x68, 0x43, 0xe4, 0x15, 0x3e, 0x9a, 0x9c, 0xc4, 0x6e, 0x84, 0xea, 0xb8, 0xa4, 0x85, 0x0c, 0xd6,
    0x71, 0x2d, 0x61, 0xca, 0xe3, 0xe2, 0x01, 0xa2, 0x5a, 0x25, 0xa7, 0x4f, 0xe6, 0xfb, 0x81, 0xbf,
    0x99, 0x35, 0x0f, 0x6f, 0xf1, 0x92, 0xa1, 0xbb, 0x2b, 0x2a, 0xfa, 0xb7, 0x8d, 0x36, 0xe2, 0x90,
    0xcb, 0xe2, 0xc0, 0x0f, 0xdd, 0x5b, 0x4d, 0x23, 0x6d, 0x9e, 0x77, 0x61, 0x25, 0x92, 0x72, 0x48,
    0xf7, 0x47, 0x35, 0xb2, 0xf6, 0xd6, 0x24, 0x1d, 0x77, 0xd6, 0x7e, 0x9b, 0x0d, 0x5c, 0x67, 0x54,
    0xc6, 0xf4, 0xcf, 0xa5, 0x32, 0x17, 0x08, 0xc6, 0x01, 0xe0, 0x12, 0xfc, 0xbe, 0xe8, 0xc5, 0x35,
    0xeb, 0xd0, 0xa8, 0xdd, 0x9a, 0xc4, 0xbe, 0x29, 0xb4, 0x66, 0x85, 0x24, 0x12, 0x4e, 0xaf, 0x33,
    0x8c, 0x29, 0x0f, 0x48, 0x8d, 0x9c, 0x1b, 0x96, 0xc1, 0x6a, 0x18, 0x12, 0x68, 0x67, 0xf0, 0x43,
    0xac, 0x8f, 0x82, 0xa9, 0x86, 0x30, 0xce, 0xa4, 0x53, 0x71, 0xd6, 0x01, 0x0f, 0x28, 0x1d, 0x8b,
    0x31, 0x73, 0xb1, 0xe5, 0x2f, 0xb9, 0x0b, 0xa1, 0x88, 0x5e,
]);

let x25519Key = new Uint8Array([
    0x65, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x9c, 0xf6, 0x7a, 0x8d, 0xce, 0xc2, 0x7f, 0xa7, 0xd9, 0xfd, 0xf1, 0xad,
    0xac, 0xf0, 0xb3, 0x8c, 0xe8, 0x16, 0xa2, 0x65, 0xcc, 0x18, 0x55, 0x60, 0xcd, 0x2f, 0xf5, 0xe5,
    0x72, 0xc9, 0x3c, 0x54, 0x20, 0xd5, 0xbb, 0x54, 0x6f, 0x1f, 0x00, 0x30, 0x4e, 0x33, 0x38, 0xb9,
    0x8e, 0x6a, 0xdf, 0xad, 0x33, 0x6f, 0x51, 0x23, 0xff, 0x4d, 0x95, 0x26, 0xdc, 0xb0, 0x74, 0xb2,
    0x5c, 0x7e, 0x85, 0x6c,
]);

let ed25519Key = new Uint8Array([
    0x66, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0xab, 0xc7, 0x0f, 0x99, 0x4f, 0x6a, 0x08, 0xd0, 0x9c, 0x5d, 0x10, 0x60,
    0xf8, 0x93, 0xd2, 0x8e, 0xe0, 0x63, 0x0e, 0x70, 0xbf, 0xad, 0x30, 0x41, 0x43, 0x09, 0x27, 0x2d,
    0xb3, 0x30, 0x95, 0xa7, 0x61, 0xd3, 0xe7, 0x53, 0x6d, 0x79, 0x5d, 0x71, 0xc2, 0x2a, 0x51, 0x2d,
    0x5e, 0xcb, 0x67, 0x3d, 0xdd, 0xde, 0xf0, 0xac, 0xdb, 0xba, 0x24, 0xfd, 0xf8, 0x3a, 0x7b, 0x32,
    0x6e, 0x05, 0xe6, 0x37,
]);

let sm2Key = new Uint8Array([
    0x96, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
    0x20, 0x00, 0x00, 0x00, 0xa4, 0x3e, 0x4b, 0x83, 0x63, 0x72, 0xfb, 0xc8, 0x08, 0xa8, 0xc1, 0xe7,
    0x2b, 0x99, 0xa6, 0x34, 0x3e, 0xd0, 0x56, 0x66, 0xa9, 0xd0, 0x60, 0x3c, 0x95, 0xcb, 0x76, 0xce,
    0x23, 0x70, 0xb6, 0xf6, 0x25, 0xd5, 0x4e, 0xdf, 0x8c, 0x2e, 0x1a, 0x55, 0x05, 0x9f, 0x2b, 0xed,
    0xaf, 0x43, 0x92, 0x34, 0x74, 0xd1, 0x4c, 0xee, 0x7e, 0xa6, 0x04, 0xdd, 0x6c, 0x3d, 0x19, 0x20,
    0x52, 0xf4, 0xb3, 0x3b, 0x37, 0x92, 0x24, 0xee, 0xef, 0x90, 0x59, 0xdb, 0x37, 0x83, 0x58, 0x66,
    0xd9, 0xa0, 0xc1, 0xd4, 0xfa, 0xfc, 0x18, 0xea, 0x87, 0xfd, 0x55, 0x19, 0xce, 0xf9, 0x27, 0xe9,
    0x48, 0x43, 0x68, 0xae,
]);

let dsa2048Key = new Uint8Array([
    0x03, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
    0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x99, 0x97, 0x76, 0x67,
    0x4a, 0xd1, 0x21, 0xe2, 0xbd, 0x75, 0xf3, 0x05, 0x34, 0xe6, 0xc2, 0x27, 0xf9, 0x4b, 0xb0, 0x47,
    0xb4, 0x7c, 0xc0, 0x16, 0x05, 0x2c, 0x93, 0xd2, 0xdf, 0xe6, 0x13, 0xa8, 0x9b, 0xf4, 0x99, 0x33,
    0x05, 0xf0, 0x0c, 0xa9, 0x88, 0xcc, 0xb0, 0x3e, 0x17, 0x6b, 0x67, 0xc7, 0x8e, 0x31, 0x6d, 0xf7,
    0x34, 0xfe, 0xdd, 0x76, 0x8e, 0x3d, 0xfa, 0x8c, 0x39, 0xdd, 0xce, 0xfa, 0xa9, 0xe2, 0x7b, 0xc0,
    0x01, 0x23, 0xf6, 0x62, 0x93, 0x77, 0x69, 0x91, 0x6e, 0xa5, 0x32, 0x46, 0xbb, 0x95, 0x67, 0x81,
    0xbd, 0xe8, 0xb1, 0xe4, 0xdf, 0xc8, 0x75, 0x99, 0x23, 0xc0, 0x29, 0x1b, 0xc7, 0x23, 0x0b, 0xf2,
    0x11, 0xb8, 0x0e, 0x59, 0x25, 0xe3, 0xa2, 0x3f, 0x22, 0xe4, 0xf6, 0x20, 0xd2, 0xdf, 0x58, 0xd2,
    0x99, 0xd8, 0x62, 0x9a, 0x24, 0x2e, 0x13, 0x4b, 0xea, 0xc9, 0x8c, 0xf9, 0x90, 0x6d, 0xa4, 0x34,
    0x27, 0x67, 0xee, 0x5c, 0x10, 0x63, 0x58, 0xc0, 0x96, 0x7b, 0x2d, 0x5b, 0x6c, 0xcd, 0x0c, 0x7b,
    0x18, 0xcc, 0x0d, 0x7d, 0x3a, 0xa7, 0x57, 0x9c, 0x12, 0x10, 0x8a, 0x3a, 0xf4, 0x6b, 0xe4, 0x38,
    0xba, 0x9c, 0xf4, 0x7c, 0x27, 0xeb, 0x06, 0x88, 0x35, 0x6b, 0xd7, 0x01, 0xe3, 0x71, 0x48, 0x41,
    0xa4, 0x1d, 0x9b, 0x1d, 0x06, 0x8a, 0x1f, 0x2c, 0x9d, 0xac, 0x81, 0x50, 0x4d, 0x9b, 0x05, 0xcf,
    0xa2, 0x3f, 0x5c, 0x84, 0x97, 0x82, 0xa6, 0x27, 0x77, 0x88, 0xfa, 0x8a, 0x34, 0x8f, 0x23, 0xcb,
    0x79, 0x51, 0x07, 0xfb, 0x43, 0xab, 0x75, 0xee, 0xd4, 0x0c, 0x6a, 0x4c, 0x5e, 0x1a, 0xc1, 0xa1,
    0xd7, 0x32, 0xf8, 0xbe, 0x2b, 0x82, 0xa1, 0x69, 0x4f, 0x24, 0x25, 0x24, 0x35, 0x5d, 0xf1, 0x4e,
    0x07, 0x0b, 0x0b, 0xb5, 0x79, 0x44, 0xcf, 0xea, 0xb6, 0xfa, 0x99, 0x60, 0x34, 0x5d, 0xad, 0xca,
    0x3a, 0x6c, 0x9e, 0xa1, 0x81, 0xe0, 0x51, 0xc2, 0x10, 0x0e, 0x6c, 0x61, 0x78, 0x07, 0x94, 0x2f,
    0xca, 0x0e, 0x04, 0x48, 0x01, 0xaf, 0x29, 0x17, 0x3e, 0x95, 0x99, 0x2d, 0xa3, 0x45, 0xc9, 0x21,
    0x8a, 0xce, 0x76, 0xf9, 0x52, 0x6e, 0x49, 0x2f, 0x25, 0x05, 0xa9, 0xde, 0xdb, 0xd7, 0x6b, 0x39,
    0x59, 0x9c, 0x73, 0xe4, 0xf0, 0xe9, 0x39, 0xd0, 0xb5, 0x12, 0x3d, 0xc0, 0xb5, 0x2a, 0x08, 0xf3,
    0x0a, 0xa4, 0xfc, 0x4a, 0xdb, 0x00, 0x83, 0x85, 0x05, 0xd2, 0xea, 0x9e, 0x0b, 0xa9, 0x1f, 0x68,
    0x77, 0xd6, 0x13, 0x82, 0xdb, 0xf9, 0x52, 0xe5, 0xae, 0x26, 0x37, 0x2d, 0x8b, 0xbd, 0x2e, 0x1d,
    0x9e, 0x0c, 0xf2, 0xab, 0x1c, 0xe9, 0x78, 0xad, 0x76, 0x16, 0x55, 0x12, 0x81, 0xe0, 0xc9, 0x99,
    0x43, 0x9e, 0xf9, 0x78, 0x31, 0x27, 0x7d, 0x13, 0xd7, 0x05, 0x8c, 0xd7, 0xef, 0x47, 0xc4, 0x9a,
    0xc5, 0xa2, 0x99, 0x2a, 0x6a, 0xa0, 0xd8, 0xc7, 0x26, 0xde, 0xf6, 0xa2, 0x24, 0x12, 0x66, 0x4e,
    0x90, 0xa1, 0xe2, 0x9e, 0xaa, 0xb3, 0x40, 0x93, 0x2a, 0x9d, 0x23, 0x85, 0xec, 0x64, 0xa6, 0x20,
    0xdb, 0xe4, 0xbe, 0x8e, 0xe5, 0x4e, 0xec, 0xf6, 0xa8, 0xca, 0x9b, 0x0d, 0x3e, 0x34, 0x5c, 0x7a,
    0xb7, 0x38, 0x2d, 0x41, 0x48, 0x0c, 0x03, 0xc3, 0x55, 0xfa, 0x10, 0x81, 0x62, 0xc4, 0x08, 0x30,
    0xf5, 0x39, 0x4b, 0x5f, 0x32, 0x22, 0x50, 0x6f, 0x9f, 0xcb, 0xb2, 0x8a, 0x9e, 0x45, 0x71, 0xe2,
    0xec, 0xc5, 0x67, 0xeb, 0x3c, 0xe5, 0x8f, 0x16, 0x44, 0x19, 0xe3, 0x2d, 0xa5, 0x8f, 0xd7, 0xdb,
    0x40, 0x3a, 0x17, 0xa9, 0x0c, 0x19, 0x8b, 0x00, 0x69, 0x22, 0x8d, 0x3f, 0x52, 0x9f, 0x43, 0x06,
    0xd5, 0x5d, 0x79, 0x60, 0xa9, 0xc2, 0xd4, 0x3c, 0x1e, 0x81, 0x05, 0x6e, 0x37, 0x77, 0x82, 0x51,
    0x25, 0x74, 0x6a, 0x99, 0xaa, 0xb0, 0xf2, 0x4f, 0x40, 0x2b, 0x29, 0x3f, 0x34, 0x9c, 0x97, 0x42,
    0x63, 0x9c, 0x49, 0xe8, 0x09, 0x3a, 0xbf, 0x26, 0x8c, 0xcb, 0x7e, 0x11, 0xc4, 0x59, 0x2b, 0xa5,
    0xe1, 0x19, 0x89, 0xf2, 0x2c, 0xde, 0x54, 0x08, 0xd3, 0xfa, 0xd3, 0x37, 0x40, 0xd3, 0xc0, 0x88,
    0xe1, 0x08, 0xf0, 0x06, 0xd4, 0x65, 0x82, 0x46, 0xbe, 0xa1, 0x82, 0xdd, 0x1c, 0x2d, 0x79, 0x2c,
    0x1e, 0x9d, 0x9a, 0x69, 0xe3, 0x59, 0xa6, 0xc9, 0xbe, 0xb3, 0x55, 0x2e, 0x9d, 0xc6, 0xfd, 0x77,
    0x33, 0xfe, 0x61, 0x31, 0x6a, 0x2d, 0xcf, 0x12, 0xb9, 0x1f, 0x58, 0x4a, 0xac, 0xd4, 0xbc, 0xd0,
    0xf7, 0xb7, 0x16, 0x3a, 0x6b, 0x80, 0x3e, 0x22, 0x74, 0x81, 0xde, 0x51, 0x29, 0x95, 0xe6, 0x28,
    0x0c, 0xaf, 0x64, 0xba, 0x11, 0x0e, 0x1a, 0xae, 0xb5, 0xb8, 0x40, 0x59, 0xed, 0x75, 0x5a, 0x5e,
    0x54, 0x0b, 0xba, 0x8a, 0xb2, 0x14, 0x23, 0xb0, 0xec, 0x68, 0x18, 0xa1, 0xd2, 0xfa, 0x2d, 0x16,
    0x15, 0xab, 0x1f, 0x0b, 0x18, 0x32, 0x93, 0xc2, 0xd0, 0x54, 0xe0, 0x37, 0x6f, 0xff, 0x0d, 0x67,
    0x4a, 0x90, 0x41, 0x06, 0x33, 0xfc, 0xab, 0xf8, 0xdc, 0x1e, 0x16, 0xf2, 0x06, 0x93, 0xe3, 0x52,
    0x18, 0x46, 0x5e, 0xe3, 0x7f, 0xba, 0x98, 0x56, 0x89, 0x0b, 0xce, 0x0b, 0xba, 0x01, 0xe2, 0x66,
    0x71, 0x85, 0x2a, 0x32, 0x43, 0x9d, 0x48, 0xaf, 0xb9, 0xe4, 0xd3, 0xc8, 0xdc, 0x3a, 0x8e, 0xb4,
    0xf0, 0xa5, 0x11, 0xd4, 0x5f, 0xbf, 0x65, 0x62, 0x76, 0x4c, 0x30, 0xfb, 0x29, 0x1c, 0x15, 0xa6,
    0x16, 0x8a, 0x7f, 0x17, 0x56, 0x40, 0x79, 0x33, 0xd4, 0x91, 0x29, 0xf1, 0x39, 0x8d, 0xfd, 0x48,
    0x97, 0x84, 0xc6, 0x42, 0x1e, 0x83, 0xd2, 0xe5, 0xf9, 0xa4, 0x26, 0x3c, 0xb8, 0x6a, 0xce, 0x8b,
    0xb5, 0x0d, 0xd8, 0x72, 0x38, 0x3b, 0x65, 0xc8, 0x7c, 0x01, 0xf7, 0x6d, 0x8d, 0x50, 0x87, 0xc2,
    0xce, 0x55, 0xfb, 0xe4, 0xf9, 0xe2, 0x98, 0x28, 0x9e, 0x05, 0xdf, 0x28, 0xcc, 0x0f, 0xe3, 0x54,
    0x64, 0x36, 0x2d, 0xa4, 0x7c, 0x5a, 0x0c, 0xcd, 0xe0, 0x51, 0x8f, 0x38, 0x3a, 0xe7, 0x82, 0x3a,
    0x62, 0x69, 0xce, 0xee, 0x53, 0x2a, 0x7c, 0xec, 0x46, 0x5c, 0x51, 0x33,
]);

let genWrappingKeyParams = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_ECC
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PADDING,
            value: huks.HuksKeyPadding.HUKS_PADDING_NONE
        }
    )
}

let genWrappingKeyParamsX25519 = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_X25519
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_UNWRAP
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256
        }
    )
}

let genCallerEcdhParams = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_ECC
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256
        }
    )
}

let genCallerX25519Params = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_X25519
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256
        }
    )
}

let importParamsCallerKek = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_AES
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PADDING,
            value: huks.HuksKeyPadding.HUKS_PADDING_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
            value: huks.HuksCipherMode.HUKS_MODE_GCM
        },
        {
            tag: huks.HuksTag.HUKS_TAG_DIGEST,
            value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_IV,
            value: stringToUint8Array(IV)
        }
    ),
    inData: stringToUint8Array(callerAes256Kek)
}

let importParamsAgreeKey = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_AES
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PADDING,
            value: huks.HuksKeyPadding.HUKS_PADDING_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
            value: huks.HuksCipherMode.HUKS_MODE_GCM
        },
        {
            tag: huks.HuksTag.HUKS_TAG_DIGEST,
            value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_IV,
            value: stringToUint8Array(IV)
        }
    ),
}

let callerAgreeParams = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_ECDH
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256
        }
    )
}

let callerAgreeParamsX25519 = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_X25519
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_AGREE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_CURVE25519_KEY_SIZE_256
        }
    )
}

let encryptKeyCommonParams = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_AES
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PADDING,
            value: huks.HuksKeyPadding.HUKS_PADDING_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
            value: huks.HuksCipherMode.HUKS_MODE_GCM
        },
        {
            tag: huks.HuksTag.HUKS_TAG_NONCE,
            value: stringToUint8Array(NONCE)
        },
        {
            tag: huks.HuksTag.HUKS_TAG_ASSOCIATED_DATA,
            value: stringToUint8Array(AAD)
        }
    ),
}

let importWrappedAes192Params = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_AES
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT |
            huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_192
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PADDING,
            value: huks.HuksKeyPadding.HUKS_PADDING_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
            value: huks.HuksCipherMode.HUKS_MODE_CBC
        },
        {
            tag: huks.HuksTag.HUKS_TAG_DIGEST,
            value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_UNWRAP_ALGORITHM_SUITE,
            value: huks.HuksUnwrapSuite.HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING
        },
        {
            tag: huks.HuksTag.HUKS_TAG_IV,
            value: stringToUint8Array(IV)
        }
    )
}

let importWrappedAes192ParamsX25519 = {
    properties: new Array(
        {
            tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
            value: huks.HuksKeyAlg.HUKS_ALG_AES
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PURPOSE,
            value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT |
            huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
        },
        {
            tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
            value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_192
        },
        {
            tag: huks.HuksTag.HUKS_TAG_PADDING,
            value: huks.HuksKeyPadding.HUKS_PADDING_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
            value: huks.HuksCipherMode.HUKS_MODE_CBC
        },
        {
            tag: huks.HuksTag.HUKS_TAG_DIGEST,
            value: huks.HuksKeyDigest.HUKS_DIGEST_NONE
        },
        {
            tag: huks.HuksTag.HUKS_TAG_UNWRAP_ALGORITHM_SUITE,
            value: huks.HuksUnwrapSuite.HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING
        },
        {
            tag: huks.HuksTag.HUKS_TAG_IV,
            value: stringToUint8Array(IV)
        }
    )
}

async function publicGenerateItemFunc(keyAlias, huksOptions) {
    console.info(`enter promise generateKeyItem`);
    try {
        await huks.generateKeyItem(keyAlias, huksOptions)
            .then(data => {
                console.info(`promise: generateKeyItem success, data = ${JSON.stringify(data)}`);
            })
            .catch(err => {
                console.error(`callback: generateKeyItem failed, code: ${err.code}, msg: ${err.message}`);
                expect(null).assertFail();
            })
    } catch (err) {
        console.error(`callback: generateKeyItem invalid, code: ${err.code}, msg: ${err.message}`);
        expect(null).assertFail();
    }
}

async function publicImportKeyItemFunc(keyAlias, HuksOptions) {
    console.info(`enter promise importKeyItem`);
    try {
        await huks.importKeyItem(keyAlias, HuksOptions)
            .then(data => {
                console.info(`promise: importKeyItem success, data = ${JSON.stringify(data)}`);
            }).catch(err => {
                console.error(`promise: importKeyItem failed, code: ${err.code}, msg: ${err.message}`);
                expect(null).assertFail();
            })
    } catch (err) {
        console.error(`promise: importKeyItem input arg invalid, code: ${err.code}, msg: ${err.message}`);
        expect(null).assertFail();
    }
}

async function publicDeleteKeyItemFunc(KeyAlias, HuksOptions) {
    console.info(`enter promise deleteKeyItem`);
    try {
        await huks.deleteKeyItem(KeyAlias, HuksOptions)
            .then(data => {
                console.info(`promise: deleteKeyItem key success, data = ${JSON.stringify(data)}`);
            })
            .catch(err => {
                console.error(`promise: deleteKeyItem failed, code: ${err.code}, msg: ${err.message}`);
                expect(null).assertFail();
            })
    } catch (err) {
        console.error(`promise: deleteKeyItem input arg invalid, code: ${err.code}, msg: ${err.message}`);
        expect(null).assertFail();
    }
}

function importWrappedKeyItem(keyAlias, wrappingKeyAlias, huksOptions) {
    return new Promise((resolve, reject) => {
        try {
            huks.importWrappedKeyItem(keyAlias, wrappingKeyAlias, huksOptions, function (error, data) {
                if (error) {
                    reject(error);
                } else {
                    resolve(data);
                }
            });
        } catch (error) {
            expect(null).assertFail();
        }
    });
}

async function publicImportWrappedKeyFunc(keyAlias, wrappingKeyAlias, huksOptions) {
    console.info(`enter callback importWrappedKeyItem`);
    try {
        await importWrappedKeyItem(keyAlias, wrappingKeyAlias, huksOptions)
            .then((data) => {
                console.info(`callback: importWrappedKeyItem success, data = ${JSON.stringify(data)}`);
            })
            .catch(error => {
                console.error(`callback: importWrappedKeyItem failed, code: ${error.code}, msg: ${error.message}`);
                expect(null).assertFail();
            });
    } catch (error) {
        console.error(`callback: importWrappedKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`);
        expect(null).assertFail();
    }
}

async function publicImportWrappedKeyPromise(keyAlias, wrappingKeyAlias, huksOptions) {
    console.info(`enter callback importWrappedKeyItem`);
    try {
        await huks.importWrappedKeyItem(keyAlias, wrappingKeyAlias, huksOptions)
            .then((data) => {
                console.info(`callback: importWrappedKeyItem success, data = ${JSON.stringify(data)}`);
            })
            .catch(error => {
                console.error(`callback: importWrappedKeyItem failed, code: ${error.code}, msg: ${error.message}`);
                expect(null).assertFail();
            });
    } catch (error) {
        console.error(`callback: importWrappedKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`);
        expect(null).assertFail();
    }
}

async function publicInitFunc(srcKeyAlias, HuksOptions) {
    let handle;
    console.info(`enter promise doInit`);
    try {
        await huks.initSession(srcKeyAlias, HuksOptions)
            .then((data) => {
                console.info(`promise: doInit success, data = ${JSON.stringify(data)}`);
                handle = data.handle;
            })
            .catch(error => {
                console.error(`promise: doInit key failed, code: ${error.code}, msg: ${error.message}`);
                expect(null).assertFail();
            });
    } catch (error) {
        console.error(`promise: doInit input arg invalid, code: ${error.code}, msg: ${error.message}`);
        expect(null).assertFail();
    }
    return handle;
}

async function publicUpdateSessionFunction(handle, HuksOptions) {
    const maxUpdateSize = 64;
    const inData = HuksOptions.inData;
    const lastInDataPosition = inData.length - 1;
    let inDataSegSize = maxUpdateSize;
    let inDataSegPosition = 0;
    let isFinished = false;
    let outData = [];

    while (inDataSegPosition <= lastInDataPosition) {
        if (inDataSegPosition + maxUpdateSize > lastInDataPosition) {
            isFinished = true;
            inDataSegSize = lastInDataPosition - inDataSegPosition + 1;
            console.error(`enter promise doUpdate`);
            break;
        }
        HuksOptions.inData = new Uint8Array(
            Array.from(inData).slice(inDataSegPosition, inDataSegPosition + inDataSegSize)
        );
        console.error(`enter promise doUpdate`);
        try {
            await huks.updateSession(handle, HuksOptions)
                .then((data) => {
                    console.error(`promise: doUpdate success, data = ${JSON.stringify(data)}`);
                    outData = outData.concat(Array.from(data.outData));
                })
                .catch(error => {
                    console.error(`promise: doUpdate failed, code: ${error.code}, msg: ${error.message}`);
                    expect(null).assertFail();
                });
        } catch (error) {
            console.error(`promise: doUpdate input arg invalid, code: ${error.code}, msg: ${error.message}`);
            expect(null).assertFail();
        }
        if ((!isFinished) && (inDataSegPosition + maxUpdateSize > lastInDataPosition)) {
            console.log(`update size invalid isFinished = ${isFinished}`);
            console.log(`inDataSegPosition = ${inDataSegPosition}`);
            console.log(`lastInDataPosition = ${lastInDataPosition}`);
            expect(null).assertFail();
            return;
        }
        inDataSegPosition += maxUpdateSize;
    }
    return outData;
}

async function publicFinishSession(handle, HuksOptions, inData) {
    let outData = [];
    console.info(`enter promise doFinish`);
    try {
        await huks.finishSession(handle, HuksOptions)
            .then((data) => {
                console.info(`promise: doFinish success, data = ${JSON.stringify(data)}`);
                outData = inData.concat(Array.from(data.outData));
            })
            .catch(error => {
                console.error(`promise: doFinish key failed, code: ${error.code}, msg: ${error.message}`);
                expect(null).assertFail();
            });
    } catch (error) {
        console.error(`promise: doFinish input arg invalid, code: ${error.code}, msg: ${error.message}`);
        expect(null).assertFail();
    }
    return new Uint8Array(outData);
}

async function cipherFunction(keyAlias, HuksOptions) {
    let handle = await publicInitFunc(keyAlias, HuksOptions);
    let tmpData = await publicUpdateSessionFunction(handle, HuksOptions);
    let outData = await publicFinishSession(handle, HuksOptions, tmpData);
    return outData;
}

async function agreeFunction(keyAlias, HuksOptions, huksPublicKey) {
    let handle = await publicInitFunc(keyAlias, HuksOptions);
    let outSharedKey;
    HuksOptions.inData = huksPublicKey;
    console.error(`enter promise doUpdate`);
    try {
        await huks.updateSession(handle, HuksOptions)
            .then((data) => {
                console.error(`promise: doUpdate success, data = ${JSON.stringify(data)}`);
            })
            .catch(error => {
                console.error(`promise: doUpdate failed, code: ${error.code}, msg: ${error.message}`);
                expect(null).assertFail();
            });
    } catch (error) {
        console.error(`promise: doUpdate input arg invalid, code: ${error.code}, msg: ${error.message}`);
        expect(null).assertFail();
    }
    console.info(`enter promise doInit`);
    try {
        await huks.finishSession(handle, HuksOptions)
            .then((data) => {
                console.info(`promise: doInit success, data = ${JSON.stringify(data)}`);
                outSharedKey = data.outData;
            })
            .catch(error => {
                console.error(`promise: doInit key failed, code: ${error.code}, msg: ${error.message}`);
                expect(null).assertFail();
            });
    } catch (error) {
        console.error(`promise: doInit input arg invalid, code: ${error.code}, msg: ${error.message}`);
        expect(null).assertFail();
    }
    return outSharedKey;
}

async function ImportKekAndAgreeSharedSecret(callerKekAlias, importKekParams, callerKeyAlias, huksPublicKey,
    agreeParams) {
    await publicImportKeyItemFunc(callerKekAlias, importKekParams);
    outSharedKey = await agreeFunction(callerKeyAlias, agreeParams, huksPublicKey);

    importParamsAgreeKey.inData = outSharedKey;
    await publicImportKeyItemFunc(callerAgreeKeyAliasAes256, importParamsAgreeKey);
}

async function generateAndExportPublicKey(keyAlias, HuksOptions, caller) {
    await publicGenerateItemFunc(keyAlias, HuksOptions);
    try {
        await huks.exportKeyItem(keyAlias, HuksOptions)
            .then((data) => {
                console.info(`promise: exportKeyItem success, data = ${JSON.stringify(data)}`);
                if (caller) {
                    callerSelfPublicKey = data.outData;
                } else {
                    huksPubKey = data.outData;
                }
            })
            .catch(error => {
                console.error(`promise: exportKeyItem failed, code: ${error.code}, msg: ${error.message}`);
                // @ts-ignore
                expect(null).assertFail();
            });
    } catch (e) {
        console.error(`promise: generate pubKey failed, code: ${e.code}, msg: ${e.message}`);
        expect(null).assertFail();
    }
}

async function EncryptImportedPlainKeyAndKek(keyAlias) {
    encryptKeyCommonParams.inData = stringToUint8Array(keyAlias)
    let plainKeyEncData = await cipherFunction(callerKekAliasAes256, encryptKeyCommonParams);
    outKekEncTag = subUint8ArrayOf(plainKeyEncData, plainKeyEncData.length - TAG_SIZE, plainKeyEncData.length)
    outPlainKeyEncData = subUint8ArrayOf(plainKeyEncData, 0, plainKeyEncData.length - TAG_SIZE)

    encryptKeyCommonParams.inData = stringToUint8Array(callerAes256Kek)
    let kekEncData = await cipherFunction(callerAgreeKeyAliasAes256, encryptKeyCommonParams)
    outAgreeKeyEncTag = subUint8ArrayOf(kekEncData, kekEncData.length - TAG_SIZE, kekEncData.length)
    outKekEncData = subUint8ArrayOf(kekEncData, 0, kekEncData.length - TAG_SIZE)
}

async function BuildWrappedDataAndImportWrappedKey(plainKey) {
    let plainKeySizeBuff = new Uint8Array(4);
    assignLength(plainKey.length, plainKeySizeBuff, 0);

    let wrappedData = new Uint8Array(
        4 + huksPubKey.length +
            4 + AAD.length +
            4 + NONCE.length +
            4 + TAG_SIZE +
            4 + outKekEncData.length +
            4 + AAD.length +
            4 + NONCE.length +
            4 + TAG_SIZE +
            4 + plainKeySizeBuff.length +
            4 + outPlainKeyEncData.length
    );
    let index = 0;
    let AADUint8Array = stringToUint8Array(AAD);
    let NonceArray = stringToUint8Array(NONCE);

    index += assignLength(callerSelfPublicKey.length, wrappedData, index); // 4
    index += assignData(callerSelfPublicKey, wrappedData, index); // 91
    index += assignLength(AADUint8Array.length, wrappedData, index); // 4
    index += assignData(AADUint8Array, wrappedData, index); // 16
    index += assignLength(NonceArray.length, wrappedData, index); // 4
    index += assignData(NonceArray, wrappedData, index); // 12
    index += assignLength(outAgreeKeyEncTag.length, wrappedData, index); // 4
    index += assignData(outAgreeKeyEncTag, wrappedData, index); // 16
    index += assignLength(outKekEncData.length, wrappedData, index); // 4
    index += assignData(outKekEncData, wrappedData, index); // 32
    index += assignLength(AADUint8Array.length, wrappedData, index); // 4
    index += assignData(AADUint8Array, wrappedData, index); // 16
    index += assignLength(NonceArray.length, wrappedData, index); // 4
    index += assignData(NonceArray, wrappedData, index); // 12
    index += assignLength(outKekEncTag.length, wrappedData, index); // 4
    index += assignData(outKekEncTag, wrappedData, index); // 16
    index += assignLength(plainKeySizeBuff.length, wrappedData, index); // 4
    index += assignData(plainKeySizeBuff, wrappedData, index); // 4
    index += assignLength(outPlainKeyEncData.length, wrappedData, index); // 4
    index += assignData(outPlainKeyEncData, wrappedData, index); // 24

    return wrappedData;
}

export default function SecurityHuksImportJsunit() {
    describe('SecurityHuksImportJsunit', function () {
        beforeAll(async function (done) {
            useSoftware = await checkSoftware();
            done();
        });
        it('Security_HUKS_Import_API9_0100', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_0100';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyECC.HuksKeyAlgECC,
                    HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY,
                    HuksSignVerifyECC.HuksKeyECCSize256,
                    HuksSignVerifyECC.HuksTagECCDigestNONE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc256Key,
            };
            await publicGenerateItemFunc(srcKeyAlies, HuksOptions);
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_0200', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_0200';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyECC.HuksKeyAlgECC,
                    HuksSignVerifyECC.HuksKeyECCPurposeSINGVERIFY,
                    HuksSignVerifyECC.HuksKeyECCSize256,
                    HuksSignVerifyECC.HuksTagECCDigestNONE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: dsa2048Key,
            };
            try {
                await huks.importKeyItem(srcKeyAlies, HuksOptions)
                    .then(data => {
                        console.info(`promise: importKeyItem success, data = ${JSON.stringify(data)}`);
                    }).catch(err => {
                        console.error(`promise: importKeyItem failed, code: ${err.code}, msg: ${err.message}`);
                        expect(err.code == 401).assertTrue();
                    })
            } catch (err) {
                console.error(`promise: importKeyItem input arg invalid, code: ${err.code}, msg: ${err.message}`);
                expect(null).assertFail();
            }
            done();
        });

        it('Security_HUKS_Import_API9_0300', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAliesWrap = 'Security_HUKS_Import_API8_0200';
            if (useSoftware) {
                await generateAndExportPublicKey(srcKeyAliesWrap, genWrappingKeyParams, false);
                await generateAndExportPublicKey(callerKeyAlias, genCallerEcdhParams, true);

                await ImportKekAndAgreeSharedSecret(callerKekAliasAes256, importParamsCallerKek, callerKeyAlias,
                    huksPubKey, callerAgreeParams);
                await EncryptImportedPlainKeyAndKek(importedAes192PlainKey);
                let wrappedData = await BuildWrappedDataAndImportWrappedKey(importedAes192PlainKey);
                importWrappedAes192Params.inData = wrappedData;
                await publicImportWrappedKeyFunc(importedKeyAliasAes192, srcKeyAliesWrap, importWrappedAes192Params);
                await publicDeleteKeyItemFunc(srcKeyAliesWrap, genWrappingKeyParams);
                await publicDeleteKeyItemFunc(callerKeyAlias, genCallerEcdhParams);
                await publicDeleteKeyItemFunc(importedKeyAliasAes192, importWrappedAes192Params);
                await publicDeleteKeyItemFunc(callerKekAliasAes256, callerAgreeParams);
            }
            done();
        });

        it('Security_HUKS_Import_API9_0400', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAliesWrap = 'Security_HUKS_Import_API8_0400';
            if (useSoftware) {
                await generateAndExportPublicKey(srcKeyAliesWrap, genWrappingKeyParamsX25519, false);
                await generateAndExportPublicKey(callerKeyAlias, genCallerX25519Params, true);

                await ImportKekAndAgreeSharedSecret(callerKekAliasAes256, importParamsCallerKek, callerKeyAlias,
                    huksPubKey, callerAgreeParamsX25519);
                await EncryptImportedPlainKeyAndKek(importedAes192PlainKey);
                let wrappedData = await BuildWrappedDataAndImportWrappedKey(importedAes192PlainKey);
                importWrappedAes192ParamsX25519.inData = wrappedData;
                await publicImportWrappedKeyFunc(importedKeyAliasAes192, srcKeyAliesWrap,
                    importWrappedAes192ParamsX25519);
                await publicDeleteKeyItemFunc(srcKeyAliesWrap, genWrappingKeyParamsX25519);
                await publicDeleteKeyItemFunc(callerKeyAlias, genCallerX25519Params);
                await publicDeleteKeyItemFunc(importedKeyAliasAes192, importWrappedAes192ParamsX25519);
                await publicDeleteKeyItemFunc(callerKekAliasAes256, callerAgreeParams);
            }
            done();
        });

        it('Security_HUKS_Import_API9_0500', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_0500';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherAES.HuksKeyAlgAES,
                    HuksCipherAES.HuksKeyPurposeENCRYPT,
                    HuksCipherAES.HuksKeyAESSize128,
                    HuksCipherAES.HuksKeyAESPADDINGNONE,
                    HuksCipherAES.HuksKeyAESBLOCKMODE,
                    HuksCipherAES.HuksKeyAESDIGESTNONE
                ),
                inData: aes128Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_0600', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_0600';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherAES.HuksKeyAlgAES,
                    HuksCipherAES.HuksKeyPurposeENCRYPT,
                    HuksCipherAES.HuksKeyAESSize192,
                    HuksCipherAES.HuksKeyAESPADDINGNONE,
                    HuksCipherAES.HuksKeyAESBLOCKMODE,
                    HuksCipherAES.HuksKeyAESDIGESTNONE
                ),
                inData: aes192Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_0700', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_0700';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherAES.HuksKeyAlgAES,
                    HuksCipherAES.HuksKeyPurposeENCRYPT,
                    HuksCipherAES.HuksKeyAESSize256,
                    HuksCipherAES.HuksKeyAESPADDINGNONE,
                    HuksCipherAES.HuksKeyAESBLOCKMODE,
                    HuksCipherAES.HuksKeyAESDIGESTNONE
                ),
                inData: aes256Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_0900', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_0900';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherRSA.HuksKeyAlgRSA,
                    HuksCipherRSA.HuksKeyPurpose,
                    HuksSignVerifyRSA.HuksKeyRSASize512,
                    HuksCipherRSA.HuksKeyRSAPADDINGNONE,
                    HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
                    HuksCipherRSA.HuksKeyRSADIGESTSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: rsa512Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_1000', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1000';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherRSA.HuksKeyAlgRSA,
                    HuksCipherRSA.HuksKeyPurpose,
                    HuksSignVerifyRSA.HuksKeyRSASize768,
                    HuksCipherRSA.HuksKeyRSAPADDINGNONE,
                    HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
                    HuksCipherRSA.HuksKeyRSADIGESTSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: rsa768Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_1100', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1100';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherRSA.HuksKeyAlgRSA,
                    HuksCipherRSA.HuksKeyPurpose,
                    HuksSignVerifyRSA.HuksKeyRSASize1024,
                    HuksCipherRSA.HuksKeyRSAPADDINGNONE,
                    HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
                    HuksCipherRSA.HuksKeyRSADIGESTSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: rsa1024Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_1200', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1200';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherRSA.HuksKeyAlgRSA,
                    HuksCipherRSA.HuksKeyPurpose,
                    HuksSignVerifyRSA.HuksKeyRSASize2048,
                    HuksCipherRSA.HuksKeyRSAPADDINGNONE,
                    HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
                    HuksCipherRSA.HuksKeyRSADIGESTSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: rsa2048Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_1300', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1300';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherRSA.HuksKeyAlgRSA,
                    HuksCipherRSA.HuksKeyPurpose,
                    HuksSignVerifyRSA.HuksKeyRSASize3072,
                    HuksCipherRSA.HuksKeyRSAPADDINGNONE,
                    HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
                    HuksCipherRSA.HuksKeyRSADIGESTSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: rsa3072Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_1400', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1400';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherRSA.HuksKeyAlgRSA,
                    HuksCipherRSA.HuksKeyPurpose,
                    HuksSignVerifyRSA.HuksKeyRSASize4096,
                    HuksCipherRSA.HuksKeyRSAPADDINGNONE,
                    HuksCipherRSA.HuksKeyRSABLOCKMODEECB,
                    HuksCipherRSA.HuksKeyRSADIGESTSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: rsa4096Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_1500', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1500';
            let HuksOptions = {
                properties: new Array(
                    HuksHmac.HuksKeyAlg,
                    HuksHmac.HuksKeySIZE,
                    HuksHmac.HuksKeyPurpose,
                    HuksHmac.HuksTagDigestSHA1
                ),
                inData: aes512Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_1600', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1600';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyECC.HuksKeyAlgECC,
                    HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
                    HuksSignVerifyECC.HuksTagECCDigestNONE,
                    HuksSignVerifyECC.HuksKeyECCSize224,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc224Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_1700', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1700';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyECC.HuksKeyAlgECC,
                    HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
                    HuksSignVerifyECC.HuksTagECCDigestNONE,
                    HuksSignVerifyECC.HuksKeyECCSize256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc256Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_1800', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1800';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyECC.HuksKeyAlgECC,
                    HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
                    HuksSignVerifyECC.HuksTagECCDigestNONE,
                    HuksSignVerifyECC.HuksKeyECCSize384,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc384Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_1900', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_1900';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyECC.HuksKeyAlgECC,
                    HuksSignVerifyECC.HuksKeyECCPurposeSIGN,
                    HuksSignVerifyECC.HuksTagECCDigestNONE,
                    HuksSignVerifyECC.HuksKeyECCSize521,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc521Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_2000', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2000';
            let HuksOptions = {
                properties: new Array(
                    HuksAgreeECDH.HuksKeyAlgECC,
                    HuksAgreeECDH.HuksKeyPurposeECDH,
                    HuksAgreeECDH.HuksKeyECCSize224,
                    HuksAgreeECDH.HuksKeyECCDIGEST,
                    HuksAgreeECDH.HuksKeyECCPADDING,
                    HuksAgreeECDH.HuksKeyECCBLOCKMODE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc224Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_2100', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2100';
            let HuksOptions = {
                properties: new Array(
                    HuksAgreeECDH.HuksKeyAlgECC,
                    HuksAgreeECDH.HuksKeyPurposeECDH,
                    HuksAgreeECDH.HuksKeyECCSize256,
                    HuksAgreeECDH.HuksKeyECCDIGEST,
                    HuksAgreeECDH.HuksKeyECCPADDING,
                    HuksAgreeECDH.HuksKeyECCBLOCKMODE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc256Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_2200', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2200';
            let HuksOptions = {
                properties: new Array(
                    HuksAgreeECDH.HuksKeyAlgECC,
                    HuksAgreeECDH.HuksKeyPurposeECDH,
                    HuksAgreeECDH.HuksKeyECCSize384,
                    HuksAgreeECDH.HuksKeyECCDIGEST,
                    HuksAgreeECDH.HuksKeyECCPADDING,
                    HuksAgreeECDH.HuksKeyECCBLOCKMODE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc384Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_2300', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2300';
            let HuksOptions = {
                properties: new Array(
                    HuksAgreeECDH.HuksKeyAlgECC,
                    HuksAgreeECDH.HuksKeyPurposeECDH,
                    HuksAgreeECDH.HuksKeyECCSize521,
                    HuksAgreeECDH.HuksKeyECCDIGEST,
                    HuksAgreeECDH.HuksKeyECCPADDING,
                    HuksAgreeECDH.HuksKeyECCBLOCKMODE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ecc521Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_2400', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2400';
            let HuksOptions = {
                properties: new Array(
                    HuksKeyAlgX25519.HuksKeyAlgX25519,
                    HuksKeyAlgX25519.HuksKeyPurposeAGREE,
                    HuksKeyAlgX25519.HuksKeyCURVE25519Size256,
                    HuksKeyAlgX25519.HuksKeyDIGEST,
                    HuksKeyAlgX25519.HuksKeyPADDING,
                    HuksKeyAlgX25519.HuksKeyBLOCKMODE,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: x25519Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_2500', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2500';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyED25519.HuksKeyAlgED25519,
                    HuksSignVerifyED25519.HuksKeyED25519PurposeSIGN,
                    HuksSignVerifyED25519.HuksKeyED25519Size256,
                    HuksSignVerifyED25519.HuksTagDigestSHA1,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: ed25519Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_2600', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAliesWrap = 'Security_HUKS_Import_API8_0200';
            if (useSoftware) {
                await generateAndExportPublicKey(srcKeyAliesWrap, genWrappingKeyParams, false);
                await generateAndExportPublicKey(callerKeyAlias, genCallerEcdhParams, true);

                await ImportKekAndAgreeSharedSecret(callerKekAliasAes256, importParamsCallerKek, callerKeyAlias,
                    huksPubKey, callerAgreeParams);
                await EncryptImportedPlainKeyAndKek(importedAes192PlainKey);
                let wrappedData = await BuildWrappedDataAndImportWrappedKey(importedAes192PlainKey);
                importWrappedAes192Params.inData = wrappedData;
                await publicImportWrappedKeyPromise(importedKeyAliasAes192, srcKeyAliesWrap, importWrappedAes192Params);
                await publicImportWrappedKeyPromise(importedKeyAliasAes192, srcKeyAliesWrap, importWrappedAes192Params);
                await publicDeleteKeyItemFunc(srcKeyAliesWrap, genWrappingKeyParams);
                await publicDeleteKeyItemFunc(callerKeyAlias, genCallerEcdhParams);
                await publicDeleteKeyItemFunc(importedKeyAliasAes192, importWrappedAes192Params);
                await publicDeleteKeyItemFunc(callerKekAliasAes256, callerAgreeParams);
            }
            done();
        });

        it('Security_HUKS_Import_API9_2700', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAliesWrap = 'Security_HUKS_Import_API8_2700';
            if (useSoftware) {
                await generateAndExportPublicKey(srcKeyAliesWrap, genWrappingKeyParams, false);
                await generateAndExportPublicKey(callerKeyAlias, genCallerEcdhParams, true);
                await ImportKekAndAgreeSharedSecret(callerKekAliasAes256, importParamsCallerKek, callerKeyAlias,
                    huksPubKey, callerAgreeParams);
                await EncryptImportedPlainKeyAndKek(importedAes192PlainKey);
                let wrappedData = await BuildWrappedDataAndImportWrappedKey(importedAes192PlainKey);
                importWrappedAes192ParamsX25519.inData = wrappedData;
                try {
                    await importWrappedKeyItem(importedKeyAliasAes192, srcKeyAliesWrap, importWrappedAes192ParamsX25519)
                        .then((data) => {
                            console.info(`callback: importWrappedKeyItem success, data = ${JSON.stringify(data)}`);
                        })
                        .catch(error => {
                            console.error(`callback: importWrappedKeyItem failed, code: ${error.code}, msg: ${error.message}`);
                            expect(error.code == 12000006).assertTrue();
                        });
                } catch (error) {
                    console.error(`callback: importWrappedKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`);
                    expect(null).assertFail();
                }
                await publicDeleteKeyItemFunc(srcKeyAliesWrap, genWrappingKeyParams);
                await publicDeleteKeyItemFunc(callerKeyAlias, genCallerEcdhParams);
            }
            done();
        });

        it('Security_HUKS_Import_API9_2800', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2800';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifyDSA.HuksKeyAlgDSA,
                    HuksSignVerifyDSA.HuksKeyDSAPurposeSIGN,
                    HuksSignVerifyDSA.HuksTagDSADigestSHA256,
                    {
                        tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
                        value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048
                    },
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: dsa2048Key,
            };
            if (useSoftware) {
                await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
                await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            }
            done();
        });

        it('Security_HUKS_Import_API9_2900', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_2900';
            let HuksOptions = {
                properties: new Array(
                    HuksSignVerifySM2.HuksKeyAlgSM2,
                    HuksSignVerifySM2.HuksKeySM2PurposeSINGVERIFY,
                    HuksSignVerifySM2.HuksKeySize256,
                    HuksSignVerifySM2.HuksTagSM2DigestSM3,
                    {
                        tag: huks.HuksTag.HUKS_TAG_IMPORT_KEY_TYPE,
                        value: huks.HuksImportKeyType.HUKS_KEY_TYPE_KEY_PAIR
                    }
                ),
                inData: sm2Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_3000', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_3000';
            let HuksOptions = {
                properties: new Array(
                    HuksHmac.HuksKeyAlg,
                    HuksHmac.HuksKeyPurpose,
                    HuksHmac.HuksKeySIZE,
                    HuksHmac.HuksTagDigestSM3
                ),
                inData: aes512Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });

        it('Security_HUKS_Import_API9_3100', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL2, async function (done) {
            const srcKeyAlies = 'Security_HUKS_Import_API8_3100';
            let HuksOptions = {
                properties: new Array(
                    HuksCipherSM4.HuksKeyAlgSM4,
                    HuksCipherSM4.HuksKeyPurposeENCRYPT,
                    HuksCipherSM4.HuksKeySM4Size128,
                    HuksCipherSM4.HuksKeySM4PADDINGNONE,
                    HuksCipherSM4.HuksKeySM4BLOCKMODECBC
                ),
                inData: aes128Key,
            };
            await publicImportKeyItemFunc(srcKeyAlies, HuksOptions);
            await publicDeleteKeyItemFunc(srcKeyAlies, HuksOptions);
            done();
        });
    })
}
